<%@page import="pl.org.waff.WaffServlet"%>
<%@page import="pl.org.waff.PathElement"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%try{%>
<jsp:useBean id="sitenavigator" class="pl.org.waff.DefaultNavigator" scope="application" />
<%  
    String oryginalPath=(String) request.getAttribute(WaffServlet.PATH_ATTRIBUTE_NAME);
    String currentPath = WaffServlet.getCurrentPath(oryginalPath);
    String template = "/WEB-INF/template.jsp";
    if (sitenavigator != null) {
        PathElement pe = sitenavigator.getPathData(currentPath, (String) request.getSession().getAttribute(WaffServlet.PATH_PREFIX_ATTRIBUTE_NAME));
        if (pe.getTemplate() != null) {
            template = pe.getTemplate();
        }
    }
%>
<jsp:include page="<%=template%>"/>
<%}catch(Exception e){
    request.setAttribute(WaffServlet.errArgumentName,e.getMessage());
    %>
<jsp:include page="/WEB-INF/error.jsp"/>
<%}%>
